package com.fjec.devops.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjec.common.protocol.JsonResult;
import com.fjec.devops.service.ActivityService;
import org.apache.commons.collections.MapUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("")
public class ActivityController {

    @Resource
    private ActivityService service;

    /**
     * 礼物管理
     * @param searchBy
     * @param title
     * @param busiType
     * @param opeType
     * @param startTime
     * @param endTime
     * @param page
     * @return
     */
    @GetMapping("/y/gift/giftChangeRecords")
    public JsonResult giftChangeRecords(@RequestParam(required = false) Integer searchBy,
                                        @RequestParam(required = false) String title,
                                        @RequestParam(required = false) Integer busiType,
                                        @RequestParam(required = false) Integer opeType,
                                        @RequestParam(required = false) String startTime,
                                        @RequestParam(required = false) String endTime, Page page) {
        Map<String, Object> result = service.giftChangeRecords(searchBy, title, busiType, opeType,
                startTime, endTime, page);
        List<Map<String, Object>> data = (List<Map<String, Object>>) result.get("data");
        return JsonResult.success().data(data).total(MapUtils.getLong(result, "total")).build();
    }

    @GetMapping("/y/gift/giftChangeRecordsDetail")
    public JsonResult giftChangeRecordsDetail(Integer opeType, Long opeId) {
        return null;
    }
}
